package com.wjk.kylin.mall.admin.controller;


import com.wjk.kylin.mall.admin.service.IMenuService;
import com.wjk.kylin.mall.common.core.dto.admin.UserIdInDTO;
import com.wjk.kylin.mall.common.core.dto.admin.UserNameInDTO;
import com.wjk.kylin.mall.common.core.dto.base.BaseOutDTO;
import com.wjk.kylin.mall.common.core.dto.base.DataOutDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 菜单表 前端控制器
 * </p>
 *
 * @author wangjinkui
 * @since 2021-11-21
 */
@Validated
@RestController
@RequestMapping("/menu")
public class MenuController {
    @Autowired
    private IMenuService menuService;

    /**
     * 根据用户id查询权限
     *
     * @param inDTO
     * @return
     */
    @PostMapping("/getMenuPermsByUser")
    public BaseOutDTO getMenuPermsByUser(@RequestBody UserIdInDTO inDTO) {
        List<String> list = menuService.getMenuPermsByUser(inDTO);
        return DataOutDTO.builder().data(list).build();
    }
}

